<?php
class Application_Model_SOAPWSManager
{
    public static function ccCheck ($wstype, $parameter)
    {  
    	$options = Zend_Registry::get("webOptions");
        $webService= $options["SOAP"][$wstype];
        $location=$webService["wsdl"];
        $parameterOption=array('encoding' => 'UTF-8', 'cache_wsdl' => WSDL_CACHE_NONE);
        $result=null;
        try {
            switch ($wstype) {
            	case "personal":
            		$userName=$webService["username"];
            		$password=$webService["password"];
            		$parameterOption['login']=$userName;
            		$parameterOption['password']=$password;
            		$client = new SoapClient($location, $parameterOption
            		);
            		$reponse = $client->checkCard(array("jsonData" => Zend_Json::encode($parameter)));
            		$result = new Application_Model_CheckCardResponse($reponse->return);
            		;
            		break;
                case "default":
            	default:
            		$client = new SoapClient($location, $parameterOption);
            		$request=new Application_Model_CheckCardRequest($parameter);
            		$reponse = $client->checkCard($request);
            		$result=new Application_Model_CheckCardResponse($reponse);
            		;
            	break;
            }
            
        } catch (Exception $e) {
            Application_Model_LogManager::wirtelog($e->getMessage());
        }
        return $result;
    }
}

